export default config => {
  let rules = config
    .map(({ name, chineseName, lang, prop, trigger = 'blur', type }) => {
      if (prop) {
        // let upperProp =  name.slice(0, 1).toUpperCase() + name.slice(1)
        if (type === 'select') {
          trigger = 'change'
        }
        return `
                ${name}: [{ required: true,  trigger: '${trigger}', message: '${chineseName}不能为空' }],\n
            `
      }
    })
    .join(' ')
  let formRules = `
        formRules: {\n ${rules} \n}
    `
  return formRules
}
